<?php
//strtolower、strtoupper转换成小写、大写
echo strtolower("How Are You.\n"); //how are you.
echo strtoupper("I'm fine, Thank you.\n"); //I'M FINE, THANK YOU.
echo strtoupper("e8_ae_a1_e7_ae_97\n"); //E8_AE_A1_E7_AE_97
//printf显示格式化字符串
$a=32.856;
printf("[%f] [%1$.1f] [%1$6.1f] [%1$-6.1f]\n", $a); //[32.856000] [32.9] [  32.9] [32.9  ]
$s="Hello World!";
printf("[%s] [%1$.5s] [%1$8.5s] [%1$'-8.5s]\n", $s); //[Hello World!] [Hello] [   Hello] [---Hello]
$s="汉字";
printf("[%s] [%1$.3s] [%1$6.3s] [%1$'-8.3s]\n", $s); //[汉字] [汉] [   汉] [-----汉]
//substr取子串
echo substr("Hello",0,3),"\n"; //Hel
echo substr("Hello",2),"\n"; //llo
//-3表示字符串后边的3个字符不要了
echo substr("Hello",0,-3),"\n"; //He
//-4表示从倒数第4个字符开始取子串
echo substr("Hello",-4,-2),"\n"; //el
//str_starts_with、str_ends_with 以子串开始或结束
var_dump(str_starts_with("Hello","ll")); //bool(false)
var_dump(str_starts_with("Hello","he")); //bool(false)
var_dump(str_starts_with("Hello","He")); //bool(true)
var_dump(str_ends_with("Hello","llo")); //bool(true)

